package com.un.web.topic.controller;

import cn.hutool.db.Page;
import com.un.core.common.R;
import com.un.web.topic.domian.vo.TopicVO;
import com.un.web.topic.service.TopicService;
import com.un.web.topic.service.TopicUserTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author xingjian
 * @Date 2023-02-21
 **/

@RestController
@RequestMapping("/refresh")
public class RefreshTopicController {

    @Autowired
    private TopicService topicService;


    @Autowired
    private TopicUserTopicService topicUserTopicService;

    @GetMapping("listPage")
    public R getAll(Page page){
        //PageInfo<TopicJava> list = topicService.selectAllByPage(page);
        return R.success();
    }

    @GetMapping("getOne/{topicTypeId}")
    public R getOne(@PathVariable Integer topicTypeId){
        TopicVO topicVO = topicService.getNewTopic(topicTypeId);
        return R.success(topicVO);
    }

    @GetMapping("getNext")
    public R getNext(Integer topicId,Integer typeId){
        TopicVO topicVO = topicService.getNextTopic(topicId,typeId);
        return R.success(topicVO);
    }
}
